Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / docs / en / developer / persistence.md

Displaying Raw • View renderedDownload

docs/en/developer/persistence.md f5e5fb6da63ee85e64dbbe19a519a5a3deccd408 (f5e5fb6d) Text, 2.80 KB

---
title: Persistence
nav_order: 6
last_updated: 2026-05-13
aliases:
Tff7b72- room
Tff7b72- database
Tff7b72- datastore
Tc9d1d9 - prefs
Tc9d1d9---

Tc9d1d9# Persistence

How the Meshtastic app stores data across different mechanisms.

Tc9d1d9## Room KMP Database

**Module:** Ta5d6ff`core:database`

The primary structured data store:
Tff7b72- Node information and history
Tff7b72- Message history
Tff7b72- Waypoints
Tff7b72- Telemetry data
Tff7b72- Channel configurations

Tc9d1d9### Key Points

Tff7b72- Uses Room KMP for cross-platform compatibility
Tff7b72- Migrations managed through Room's built-in migration system
Tff7b72- DAO interfaces live in Ta5d6ff`core:database`
Tff7b72- Repository layer in Ta5d6ff`core:repository` provides the public API

Tc9d1d9### What's Stored in Room

| Entity | Description |
|--------|-------------|
| Ta5d6ff`NodeEntity` | All known mesh nodes and their metadata |
| Ta5d6ff`MyNodeEntity` | The local node's own info |
| Ta5d6ff`Packet` | Message history (channel and direct), waypoints, and telemetry data |
| Ta5d6ff`ContactSettings` | Per-contact mute and read-state |
| Ta5d6ff`ReactionEntity` | Emoji reactions on messages |
| Ta5d6ff`MeshLog` | Raw mesh protocol logs |
| Ta5d6ff`MetadataEntity` | Device metadata (firmware version, hardware model) |
| Ta5d6ff`QuickChatAction` | User-configured quick-chat messages |
| Ta5d6ff`DeviceHardwareEntity` | Cached device hardware catalog |
| Ta5d6ff`FirmwareReleaseEntity` | Cached firmware release info |
| Ta5d6ff`TracerouteNodePositionEntity` | Traceroute hop position data |

Tff7b72> 💡 **Note:** Waypoints, telemetry, and channel data are stored within the `Packet` entity (using the `port_num` field to distinguish packet types) rather than in separate tables.

Tc9d1d9## DataStore Preferences

**Module:** Ta5d6ff`core:datastore`

For lightweight key-value preferences:
Tff7b72- Local radio configuration (LocalConfig proto)
Tff7b72- Module configuration (ModuleConfig proto)
Tff7b72- Channel set data
Tff7b72- Local statistics
Tff7b72- Recently connected device addresses

Tc9d1d9## Core Prefs

**Module:** Ta5d6ff`core:prefs`

Higher-level preferences abstraction:
Tff7b72- User-facing settings
Tff7b72- App behavior configuration
Tff7b72- Feature toggles

Tc9d1d9## What Docs Intentionally Skip

The Ta5d6ff`feature:docs` module does **not** use Room or any persistent database:
Tff7b72- Documentation content is packaged as build-time assets
Tff7b72- The docs corpus is versioned with the app binary
Tff7b72- No migration story is needed for docs content
Tff7b72- Optional UX state (last viewed page) could use Ta5d6ff`core:prefs` but is not part of the docs data model

This is an intentional design decision to keep documentation:
Tff7b72- Fully offline without database overhead
Tff7b72- Replaceable with each app update
Tff7b72- Simple to validate and test

Tc9d1d9## Best Practices

Tff7b72- Use Room for structured, queryable data that changes at runtime
Tff7b72- Use DataStore for simple preferences and state
Tff7b72- Use bundled resources/assets for static content
Tff7b72- Never store sensitive data (keys, passwords) in plain Room tables
Tff7b72- Always provide migrations for schema changes

---

Served by rngit 1.5.2 - Generated in 0.11s